set more 1
clear

pause off 

capture log close


global dir_tab_out     "../outputs"
global dir_work        "../model/out_data_new" 

******************************************************************
******************************************************************
global  dir_basedata    "out_files" 

** read estimated cognitive score and non-cognitive score 
insheet idnew thetac thetan using $dir_work/predicted_thetas.txt, clear

** merge the estimated scores to NLSY97 data 
merge 1:m id using NLSY97_PublicData_FinalSample


label var thetac "Cognitive Ability"
label var thetan "Non-cognitive Ability"
label var addiction "Years smoked as of t-1"

** Analysis for Table 3 Panels A and B is not provided here because it requires restricted access to BLS data  


** Table 3 Panel C is below: 

sum net_worth if net_worth >0

gen lognetworth = log(net_worth) if net_worth >= 100

reg lognetworth thetac thetan addiction if age == 30 
eststo regnetworth

quietly esttab regnetworth  using $dir_tab_out/Table_03_data.tex, keep(thetac thetan addiction) replace b(%9.4f) se(%9.4f) star(* 0.10 ** 0.05 *** 0.01) label title(Log Net Worth OLS Regression) nogaps compress nomtitles
